/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tasks.ui.popup;

import common.DomainException;
import domain.ArchitectureDTO;
import domain.DomainFacade;
import domain.DomainFacadeImpl;
import domain.StructureDTO;

/**
 *
 * @author Tim Hofman Laptop
 */
public class PopupControllerImpl implements PopupController{

    private DomainFacade facade;
    private ArchitectureDTO architecture;
    private StructureDTO structure;
    
    public PopupControllerImpl() {
        this.facade = DomainFacadeImpl.getInstance();
        this.architecture = facade.getArchitecture();
        this.structure = facade.getStructure();
    }
   
    @Override
    public void setArchitectureName(String name) throws DomainException {
        this.facade.setArchitectureName(name);
    }

    @Override
    public void setArchitectureAuthor(String name) throws DomainException {
        this.facade.setArchitectureAuthor(name);
    }

    @Override
    public void setStructureName(String name) throws DomainException {
        this.facade.setStructureName(name);
    }

    @Override
    public void setStructureAuthor(String name) throws DomainException {
        this.facade.setStructureAuthor(name);
    }

    @Override
    public String getArchitectureName() {
        if(architecture.getName() != null){
            return this.architecture.getName();
        }
        return "";
    }

    @Override
    public String getArchitectureAuthor() {
        if(architecture.getAuthor() != null){
            return this.architecture.getAuthor();
        }
        return "";
    }

    @Override
    public String getStructureName() {
        if(structure.getName() != null){
            return this.structure.getName();
        }
        return "";
    }

    @Override
    public String getStructureAuthor() {
        if(structure.getAuthor() != null){
            return this.structure.getAuthor();
        }
        return "";
    }
}
